<?php
namespace Controller;

class RowdataBuilder
{
    static $_instance = null;
    private $list = null;

    private function __construct()
    {
        
    }

    private function __clone()
    {
        
    }

    static function getInstance()
    {
        if (is_null(self::$_instance) || isset(self::$_instance)) {
           self::$_instance = new self();
        }

        return self::$_instance; 
    }

    public function buildData($list, $method)
    {
        if (empty($list)) {
            return false;
        }

        $this->list = $list;

        return $this->$method();
    }

    public function pay_account_cash_out()
    {
        $status = [
            -2 => '退款',
            -1 => '撤销',
            '未结算',
            '结算',
            '在途资金'
            ];

        $rowData = array(
                 $this->list['co_caid'],
                 $this->list['co_userNick'],
                 $this->list['co_uid'],
                 $this->list['co_cardaddr'],
                 $this->list['co_account'],
                 $this->list['co_money'],
                 $this->list['co_tax'],
                 number_format(($this->list['co_money'] - $this->list['co_tax']),2),
                 'T+'.$this->list['co_day'],
                 $this->list['co_toCardType'],
                 $this->list['co_arriveDateTime'],
                 $this->list['co_day_time'],
                 $status[$this->list['co_state']],
                 $this->list['co_operId'],
                 $this->list['co_operTime'],
                 $this->list['co_memo'],
                 $this->list['co_reason'],
            );

        unset($this->list);
        return $rowData;
    }
}
